package o;

import android.content.Context;
import android.content.res.Resources.NotFoundException;
import android.text.TextUtils;
import com.huawei.hms.aaid.constant.AaidIdConstant;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

class avp implements avk {
    private final Context ˎ;

    avp(Context context) {
        this.ˎ = context;
    }

    public String ˎ(String str, String str2) {
        Object ˊ = ˊ(str);
        if (!TextUtils.isEmpty(ˊ)) {
            int identifier = this.ˎ.getResources().getIdentifier(ˊ, "string", this.ˎ.getPackageName());
            if (identifier != 0) {
                try {
                    str2 = this.ˎ.getResources().getString(identifier);
                } catch (NotFoundException e) {
                }
            }
        }
        return str2;
    }

    private static String ˊ(String str) {
        try {
            return "agc_" + avn.ˏ(ˎ(str.getBytes("UTF-8")));
        } catch (UnsupportedEncodingException e) {
            return "";
        } catch (NoSuchAlgorithmException e2) {
            return "";
        }
    }

    private static byte[] ˎ(byte[] bArr) throws NoSuchAlgorithmException {
        return MessageDigest.getInstance(AaidIdConstant.SIGNATURE_SHA256).digest(bArr);
    }
}
